<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>cross the domain ...</title>
        <script src="js/socket.io.js"></script>
        <script>
            var socket = io.connect('http://localhost:8000', {transports:["websocket"]});
            socket.on('message', function (data) {
               document.getElementById('chat').innerHTML = data.hello;
            });
            function send(){
                var text = document.getElementById('text').value;
                var name = document.getElementById('name').value;
                //document.getElementById('chat').innerHTML = document.getElementById('chat').innerHTML + name + ":" + text + "</br>";

                socket.emit('SendNews',{text : text, name : name});
			}
            socket.on('SendNews',function(data){
                document.getElementById('chat').innerHTML = document.getElementById('chat').innerHTML +data.name+ ":" + data.text+ "</br>";
            });
        </script>
    </head>
    <body>
        <div id="chat"></div>
        text:<input type="TEXT" id="text" size="200"/></br>
        name:<input type="TEXT" id="name"/>
        <a href="#" onclick="send()">send</a>
    </body>
</html>